# Source Image
FROM ubuntu:14.04

# apt source
RUN sed -i s@/archive.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list \
    && apt-get update -y \
    && apt-get install -y vim ssh curl wget python3 python3-pip \
        software-properties-common ;\
        rm -rf /var/lib/apt/lists/*

# Create a new user called foam
RUN useradd --user-group --create-home --shell /bin/bash foam;\
    echo "foam ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers

# Install OF v2.3.1
RUN sh -c "wget -O - http://dl.openfoam.org/gpg.key | apt-key add -" ;\
    add-apt-repository http://dl.openfoam.org/ubuntu ;\
    apt-get update;\
    apt-get install openfoam231 ;\
    apt-get install paraviewopenfoam410 ;\
    echo "alias of231='source /opt/openfoam231/etc/bashrc'"" >> ~/.bashrc ;\
    echo "export OMPI_MCA_btl_vader_single_copy_mechanism=none" >> ~/.bashrc

USER foam
